package org.reactome.cytoscape.v3.internal;
import java.awt.event.ActionEvent;
import java.awt.Desktop;
import java.io.IOException;

import javax.swing.JOptionPane;

import org.cytoscape.application.*;
import org.cytoscape.application.swing.AbstractCyAction;
import org.cytoscape.application.swing.CySwingApplication;

public class UserGuideAction extends AbstractCyAction
{

    public UserGuideAction(CySwingApplication desktopApp)
    {
	super("User Guide");
	setPreferredMenu("Apps.Reactome FIs");
	setMenuGravity(2.0f);
	
    }

    @Override
    public void actionPerformed(ActionEvent e)
    {
	// Points to the Reactome FI Plugin online user guide.
	String userGuideURL = "http://wiki.reactome.org/index.php/Reactome_FI_Cytoscape_Plugin";
	if (Desktop.isDesktopSupported())
	{
	    try
	    {
		Desktop.getDesktop().browse(java.net.URI.create(userGuideURL));
	    } catch (IOException e1)
	    {
		JOptionPane.showMessageDialog(null, "The user guide is not available because you are working offline", "Error in showing user guide", JOptionPane.ERROR_MESSAGE);
	    }
	}
    }

}
